#version 460
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
#extension GL_EXT_debug_printf : enable


layout (push_constant) uniform SPushConstants
{
    mat4 ProjectionView;
    // vec4 Color;
    // float CameraNear;
    // float CameraFar;


} PushConstants;

layout(set=0,binding=0) uniform SModelUniformBufferObject
{
    mat4 Model;
    vec4 Color;
    vec3 ViewPos;
} ModelBuffer;

layout (location = 0) in vec3 inPos;
layout (location = 1) in vec2 inTexCoords;
layout (location = 2) in vec3 inVertexNormal;


layout (location = 0) out vec3 outNormal;
layout (location = 1) out vec2 outUV;
layout (location = 2) out vec3 outWorldPos;
layout (location = 3) out float outCameraNear;
layout (location = 4) out float outCameraFar;
layout (location = 5) out vec4 outColor;
layout (location = 6) out vec3 outViewPos;


void main() 
{
    //vec3 inPos=vec3(0,0,0);
    vec4 WorldPos=ModelBuffer.Model*vec4(inPos,1);
    gl_Position = PushConstants.ProjectionView *WorldPos;
    outUV=inTexCoords;
    outNormal= mat3(transpose(inverse(ModelBuffer.Model) ) ) * inVertexNormal; 
    outWorldPos=WorldPos.xyz;

    // outCameraNear=PushConstants.CameraNear;
    // outCameraFar=PushConstants.CameraFar;

    outColor=ModelBuffer.Color;
    outViewPos=ModelBuffer.ViewPos;
}